<template>
	<view class="content bg_com">
		<view class="main_box col_conter">
			<view class="top_img">
				<image class="img_val" v-if="user.securityMode == 1" src="../../static/youth_open.png" mode="scaleToFill"></image>
				<image class="img_val" v-else-if="user.securityMode == 0" src="../../static/youth_close.png" mode="scaleToFill"></image>
			</view>
			<view class="title">
				开启青少年模式将获得以下服务
			</view>
			<view class="list_box">
				<view class="ul row_center">
					<view class="sgin"></view>
					<view class="txt">
						部分功能限制使用
					</view>
				</view>
				<view class="ul row_center">
					<view class="sgin"></view>
					<view class="txt">
						针对青少年推送精选优化内容
					</view>
				</view>
				<view class="ul row_center">
					<view class="sgin"></view>
					<view class="txt">
						无法进行赠送，充值，提现
					</view>
				</view>
				<view class="ul row_center">
					<view class="sgin"></view>
					<view class="txt">
						每日晚22:00至次日早6:00无法使用
					</view>
				</view>
				<view class="ul row_center">
					<view class="sgin"></view>
					<view class="txt">
						单日使用时长超过40分钟，需密码验证使用
					</view>
				</view>
			</view>
			<view class="btn_warp">
				<button class="btn_item" @click="send" v-if="user.securityMode != 1" type="default">开启青少年模式</button>
				<button class="btn_item" @click="sendClose" v-if="user.securityMode == 1" type="default">关闭青少年模式</button>
			</view>
			<view class="statement row_center">
				<view class="statement_con"  @click="goWeb">《未成年保护计划》</view>
				声明
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		computed: mapState(['user']),
		data() {
			return {
				timer: null
			}
		},
		onLoad() {
			let _this = this;
			uni.$on('success',function(data) {
				_this.timer = setTimeout(() => {
					uni.showToast({
						title: data.msg
					})
				}, 500)
			})
		},
		onUnload() {
			if(this.timer) clearTimeout(this.timer);
			uni.$off('success');
		},
		methods: {
			sendClose() {
				uni.navigateTo({
					url: 'password-input?type=close'
				})
			},
			send() {
				uni.navigateTo({
					url: 'password-input?type=open'
				})
			},
			goWeb() {
				uni.navigateTo({
					url: `/pages/activeWebView/activeWebView?vurl=http://www.daxiaomao.com/wanpi/static/teenager-protect/`
				})
			}
		}
	}
</script>

<style lang="scss">
	@import './index.scss';
</style>
